home *** CD-ROM | disk | FTP | other *** search
-
- COL256 description.
- ===================
-
-
-
- What is COL256?
- ===============
-
- COL256 is a unit developed for Borland Pascal 7.0 to have access to video
- modes with 256 colors and a 'high' resolution (more than 320x200).
- I decided to program it as a unit to be independent of Borlands GRAPH unit
- and to get my own expieriences in graphics programming on a IBM-PC.
-
-
- IMPORTANT
- =========
-
- It is just a prerelease to have it tested on several machines. Eventhough I
- designed it carefully using standard VGA frequencies I could not guarantee
- that it works properly on YOUR machine, YOUR card and YOUR monitor.
-
- ----\\ ESPECIALLY I WOULD TAKE *NO* RESPONSIBILITY //----
- ---======== >> FOR ANY DAMAGE TO YOUR HARDWARE OR ANYTHING << ========---
- ----// ELSE CAUSED BY USING THIS PACKAGE. \\----
-
- If you have tested it on your machine and it worked well please send me a
- short note containing information about your graphics card and monitor
- (manufacturer, type,...). You might use the SPEED program and send me the
- LOGFILE created by SPEED. !! PLEASE ONLY EMail !!
-
-
- Features of COL256
- ==================
-
- COL256 supports:
-
- * graphic modes with a resolution of 320 or 360 pixels horizontally
- and 200,240,400 or 480 pixels vertically in ANY combination on
- almost EVERY (register compatible) VGA.
-
- ==> ^^^^^^ 'almost' because I would not guarantee that it runs on
- ==> YOUR VGA, but I checked it on a lot of cards and it worked
- ==> well.
-
- * virtual screen programming
-
- * Support of soft scrolling/panning of the vitrual screen
-
- * fast assembly routines to achieve high graphics performance and
- compact code
-
- * several pages supported if enough memory would be availiable on a
- 256 Kbyte VGA (even for virtual screens).
-
- * both DOS real mode and DOS protected mode
-
- * palette manipulation without using BIOS (thus avoiding flicker on
- screen, many BIOS'es don't care about this) so that you would be
- able to implement fine palette animations.
-
- * hardware bit manipulations as supported by a standard VGA
-
- * free definable clipping window
-
- * error reporting similar to Borlands GRAPH unit.
- (Some errors will not occur, because features are not implemented
- yet.)
-
-
- Future Plans:
-
- * Support of Borland's stroke fonts (.CHR), standard BIOS bitmap fonts
- and free defined 'sprite' fonts.
-
- * extended drawing routines (circles, ellipses, filling, etc)
-
- * full support of bitmap routines
-
- * support of higher resolutions of virtual screens using more than 256k
- video memory
-
- * GetErrorText function to make error reporting easier
-
- * TP 6.0 support
-
- * better debugging support
-
-
- System requirements
- ===================
-
- COL256 runs only on 286 or higher, so be sure to check if a 286 (or higher)
- processor is present (eventhough I think a 8086 with a VGA running at high
- resolution graphic modes would be a strange hardware combination).
- During mode initialisation COL256 will check if a VGA is present, but I'm
- NOT checking if it is register compatible.
-
-
- How to use it
- =============
-
- As usual you would have to include COL256 in your 'uses' list at the
- beginning of your program and include the directory where the TPU/TPP files
- located in your unit path. Then use the graphic procedures as described
- below.
-
-
- COL256 types and variables
- ==========================
-
- The used types for palette maipulation routines are declared as follows:
-
- type TColor = record r,g,b:byte end;
- TPalette = array[0..256] of TColor;
-
- Thus TColor holds a RGB tripel, where r,g and b values are from 0..63
- and TPalette holds 256 of those RGB tripel, describing the full palette.
-
- Constants declared by COL256 are
-
- * Mode-ID's for suported video modes:
-
- M320x200 = 0; M320x240 = 1; M320x400 = 2; M320x480 = 3;
- M360x200 = 4; M360x240 = 5; M360x400 = 6; M360x480 = 7;
-
- NotMemClear = $8000; NoStateInit = $4000;
-
- If bit 15 of <mode> is set, video memory will not be initialized
- (filled with 00h) during mode initialization. If bit 14 of <mode> is
- set, no state initialisation (grCursor,...) will be performed.
- (See EnterGraphMode for detail.)
-
- Note: y-resolution is given by bits 0 and 1,
- x-resolution is given by bit 2
-
- * Values for error reporting (same as from GRAPH):
-
- grOk = 0; { No error }
- grNoInitGraph = -1; { BGI graphics not installed }
- grNotDetected = -2; { Graphics hardware not found }
- grFileNotFound = -3; { Device driver file (.BGI) not found }
- grInvalidDriver = -4; { Invalid device driver file }
- grNoLoadMem = -5; { Not enough memory to load driver }
- grNoScanMem = -6; { Out of memory in scanfill }
- grNoFloodMem = -7; { Out of memory in flood fill }
- grFontNotFound = -8; { Fontfile (.CHR) not found }
- grNoFontMem = -9; { Not enough memory to load font }
- grInvalidMode = -10; { Invalid graphics mode (not supported) }
- grError = -11; { Graphics error (generic error) }
- grIOerror = -12; { graphics I/O error (file access) }
- grInvalidFont = -13; { Invalid font file }
- grInvalidFontNum = -14; { Invalid font number }
-
- * Write mode constants for SetWriteMode
-
- NormalPut = 0; { 00000_b }
- AndPut = 8; { 01000_b }
- OrPut = 16; { 10000_b }
- XorPut = 24; { 11000_b }
-
- Note: Use this constants, first your code gets better readable and
- second they are NOT the same as GRAPH's BitBlt constants.
-
- * Initialized Variables:
-
- const ActiveMode : integer = -1;
- OldMode : integer = -1;
-
- ActiveMode holds the mode-ID of the current mode. OldMode holds the
- video mode (as BIOS told me) before the first EnterGraphMode call.
-
- * Variables:
- var xMin,xMax,
- yMin,yMax,
- ActivePage,VisualPage,
- grCurX,grCurY : integer;
-
- GetX : integer absolute grCurX;
- GetY : integer absolute grCurY;
- GetMaxX : integer absolute xMax;
- GetMaxY : integer absolute yMax;
- GetMinX : integer absolute xMax;
- GetMinY : integer absolute yMax;
- GetVisualPage : integer absolute VisualPage;
- GetActivePage : integer absolute ActivePage;
-
- As you can see I mapped variables with the same names as the
- corresponding GRAPH functions at my internal stuff. This should be
- faster than function calls to get actual graphics position etc.
- But because I use them also for internal purposes do NEVER write
- to these variables; use the provided functions/procedures to modify
- them !
-
-
- COL256 procedures and variables
- ===============================
-
- procedure EnterGraphMode (Mode:word);
-
- Initializes the mode given by the Mode value by resetting the hardware,
- initializing internal tables/variables and clearing video memory if
- required. (See constants for modes supported.)
- If NoStateInit is set, the selected clipwindow, the selected pages and
- the graphics cursor would not be initialized (with all consequences).
-
-
- procedure ExitGraphMode;
-
- Initializes the old mode set before the first EnterGraphMode call
- using BIOS.
-
-
- function GetModeName(mode:integer):string;
-
- Returns a string describing the mode given by the mode ID, such as
- '320x240, 256 colors' for mode=M320x240 and 'Invalid Mode' for mode=12.
-
-
- procedure SetVirtualScreen(xRes,yRes:integer);
-
- Set up a virtual screen with higher 'resolution' than the one given
- by the initialized CRT mode.
-
-
- procedure SetVisualScreen (x,y:integer);
-
- Determine the visible part of the vitual screen:
-
- +----------------------- xRes ------------------------------------+
- | | |
- | y |
- | | |
- |---- x ----+--------- xVis -------------+ |
- | | | |
- | |
- | e e
- y g g
- y V . .
- R i 2 5
- e s 0 0
- s 0 0
- |
- | |visible screen | |
- | +-------- eg.320 ------------+ |
- | |
- | |
- |virtual screen |
- +------------------------- eg.500 --------------------------------+
-
-
- procedure SetClipWindow (x1,y1,x2,y2:integer);
-
- Sets the clipwindow to a rectangle defined by x=x1,x=x2,y=y1,y=y2 so that
- drawing operations would only be done inside the clipwindow. This does
- not modify the xMax,yMax,xMin,yMin variables, they are holding the
- resolution of the (virtual) screen.
-
-
- procedure unSetClipWindow;
-
- As the name implies, the clipwindow would be set to the whole (virtual)
- screen.
-
-
- procedure SetActivePage (PageNo:integer);
- procedure SetVisualPage (PageNo:integer);
- procedure SwitchPages;
-
- These procedures should be used to change pages. Read/write operations
- are ever done to the ActivePage and the VisualPage is shown on the
- output device (monitor or something you have conected to your VGA,
- whatever it is).
-
-
- procedure setWriteMode (Mode,Rotation:byte);
-
- The VGA supports bit manipulation of the data written to the video
- memory and the contents of the memory. This is done in the following
- way:
- - contents of the video memory is loaded into an internal buffer
- - the data to be written is rotated right by the specified
- number of bits
- - the specified operation (OR,AND,XOR,Nothing) is applied to the
- contents of the buffer and the rotated data
- - the result is written back to video memory
-
- All drawing routines (with one exception) work independent of the
- WriteMode set. The exception are routines ending with a '_', they will
- work correctly only if the WriteMode is NormalPut and no rotation is
- selected, but they are twice as fast as the other routines.
-
-
- function GraphResult:integer;
-
- Returns the result of the last graphics operation and cleares the
- internal error variable.
-
-
- procedure moveto (x,y:integer);
- procedure moverel (x,y:integer);
-
- Moves the graphics cursor to the specified position. (Either to
- an absolute position or relative to the actual value.
- Note: The graphics cursor would never be clipped!
-
-
- procedure scnclr (col:byte);
-
- Clear the screen by filling the ActivePage with color col.
-
-
- procedure pset (x,y:integer; c:byte); { set point }
- function ptest (x,y:integer):byte; { test point }
- procedure LineH (xa,xe,y:integer; c:byte); { horiz. line }
- procedure LineV (x,ya,ye:integer; c:byte); { vert. line }
- procedure Line (x1,y1,x2,y2:integer; c:byte); { line }
- procedure LineRel (x,y:integer; c:byte);{line, rel to Cursor}
- procedure LineTo (x,y:integer; c:byte);
-
- procedure LineH_ (xa,xe,y:integer; c:byte);
- procedure LineV_ (x,ya,ye:integer; c:byte);
- procedure Line_ (x1,y1,x2,y2:integer; c:byte);
- procedure LineRel_ (x,y:integer; c:byte);
- procedure LineTo_ (x,y:integer; c:byte);
-
- procedure Box(x1,y1,x2,y2:integer;color:byte); { filled rectangle }
- procedure Rectangle(x1,y1,x2,y2:integer;color:byte);
-
- I think, the names explain what these procedures are doing.
-
-
- procedure PutImage (x,y:integer; var Image); { put bitmap data }
- procedure PutImageNonZero (x,y:integer; var Image);
- procedure PutImage_ (x,y:integer; var Image);
- procedure PutImageNonZero_(x,y:integer; var Image);
-
- This gives you the opportunity to put bitmap data on the screen, the
- format of buffer is as follows:
-
- Buffer = record xSize,ySize : word;
- data: array[ySize,xSize] of byte;
- end;
-
- The PutImageNonZero puts only bytes <> zero, so that you would have a
- easy way to do masking and drawing just at one time.
-
- procedure SetColor(nr:byte; col:TColor);
- procedure SetPal(var pal:TPalette);
- procedure GetPal(var pal:TPalette);
-
- Use these procedures to modify the palette and color values. It should
- be clear what they do.
-
-
- Credits
- =======
-
- COL256 has been developed by Steffen Seeger using BORLAND's great BP 7.0
- package. It (COL256) is free for PRIVATE use, if you want to use it in
- your company or institution or your commercial programs contact me
- (It wouldn't be fair if you do not, because I'm a student and I spent a
- lot of spare time developing this package).
-
- (C) 1993 Steffen Seeger, all rights reserved.
-
- ===============================================================================
- | Steffen Seeger | InterNet: Seeger.Physik.TU-Chemnitz.DE |
- | Carl-von-Ossietzky-Str. 193 | |
- | Chemnitz (Germany) | |
- | 09127 | |
- ===============================================================================